package com.onec.service.route.entity;

import com.onec.service.api.enums.ProductEnum;
import com.onec.service.api.enums.StatusEnum;
import com.onec.service.api.enums.SystemTypeEnum;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 代理商
 * 渠道信息。
 * 路由配置通道参数：
 *
 * @author ONEC
 */
@Data
@Entity
@Table(name = "t_route_channel_info")
public class RouteChannelInfo implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", unique = true)
    private Long id;

    @Column(name = "version", length = 8)
    @Version
    private Integer version;

    @Column(name = "business_no")
    private String businessNo;

    @Column(name = "product", length = 8)
    @Enumerated(value = EnumType.STRING)
    private ProductEnum product;

    @Column(name = "channel_no")
    private String channelNo;

    @Column(name = "channel_business_no")
    private String channelBusinessNo;

    @Column(name = "rate", scale = 4)
    private BigDecimal rate;

    @Column(name = "fee", scale = 1)
    private BigDecimal fee;

    /**
     * 机构费率类型
     */
    @Column(name = "fee_type")
    @Enumerated(value = EnumType.STRING)
    private SystemTypeEnum feeType;


    @Column(name = "create_time")
    @CreatedDate
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;

    @Column(name = "update_time")
    @LastModifiedDate
    @Temporal(TemporalType.TIMESTAMP)
    private Date updateTime;

    @Column(name = "creator", length = 32)
    private String creator;

    @Column(name = "remarks")
    private String remarks;

    @Column(name = "status")
    @Enumerated(value = EnumType.STRING)
    private StatusEnum status;


    @Column(name = "need_register")
    private boolean needRegister;


}
